package com.relytosoft.mizar.analyze.base.enums;

import java.util.Objects;

/**
 * @author zyc
 * @version 1.0
 * @date 2022/5/27 19:57
 */
public enum DeleteStatusEnum {


    NOT_DELETED("未删除", 0),

    DELETED("已删除", 1);


    String name;
    int value;


    DeleteStatusEnum(String name, int value) {
        this.name = name;
        this.value = value;
    }

    public static DeleteStatusEnum getByValue(Integer value) {
        if (Objects.isNull(value)) {
            return null;
        }

        DeleteStatusEnum[] values = DeleteStatusEnum.values();
        for (DeleteStatusEnum statusEnum : values) {
            if (Objects.equals(value, statusEnum.getValue())) {
                return statusEnum;
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public int getValue() {
        return value;
    }

    @Override
    public String toString() {
        return "DeleteStatusEnum{" +
                "name='" + name + '\'' +
                ", value=" + value +
                '}';
    }
}
